package cn.bluedot.framework.util;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * 	获取当前线程的域对象
 * @author Administrator
 *
 */
public class WebContext {

	//线程私有的变量
	public static ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
	
	public static ThreadLocal<HttpServletResponse> response = new ThreadLocal<>();
	
	public static HttpServletRequest getRequest(){
        return request.get();
    }

    public static HttpSession getSession(){
        return request.get().getSession();
    }

    public static ServletContext getServletContext(){
        return request.get().getSession().getServletContext();
    }

    public static HttpServletResponse getResponse(){
        return response.get();
    }
	
}
